package edu.bw.config;

import org.springframework.context.annotation.*;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.sql.Connection;

@Configuration //代表这是一个Spring配置类,相当于xml配置转换为java类和注解的形式
@ComponentScan("edu.bw") //扫描包以及子包下的注解,相当于配置文件中<context:component-scan base-package="edu.bw"/>
@PropertySource("classpath:db.properties")//加载properties配置文件,相当于配置文件中的----
@Import({DBConfig.class,TransactionConfig.class})//自动导入DBConfig
@EnableAspectJAutoProxy //开启AOP扫描
@EnableTransactionManagement //开启事务扫描  <tx:annotation-driven transaction-manager="transactionManager"/>
public class SpringConfig {


    @Bean("threadLocal")
    public ThreadLocal<Connection> createThreadLocal(){
        return new ThreadLocal<>();
    }

}
